﻿/// ---------------------------------------------
/// 2012.5.4
/// 汪定新
///
/// ---------------------------------------------

//双击事件
function CustomDbClick() {
    if (typeof (fnCustomEdit) == "function") {
        fnCustomEdit();
    }
}
//----------------------------------------------

//增加
var fnCustomAdd = function () {
    var list = this.mDataTable.getRecordSet()._records;
    var flag = false;
    for (var i = 0; i < list.length; i++) {
        if (list[i]._oData["SalaryStatus"] == "调整薪资") { //调薪申请已经提交,则不能再提交
            flag = true;
            break;
        }
    }
    if (flag) {
        alert("该员工已经有调薪申请提交待审核生效,不能重复提交!");
        return;
    }
    document.getElementById("dialog1_h").innerHTML = "新增薪资异动记录";
    document.getElementById("EditUIWindow").src = "AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity;
    SetDWH(550, 350, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}
//编辑
var fnCustomEdit = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    if (record == null) {
        alert("请选择一条记录");
        return;
    }
    if (record.getData("SalaryStatus") != "调整薪资")//已过期的和正在使用的不能修改
    {
        alert("该数据信息不能修改!");
        return;
    }
    document.getElementById("dialog1_h").innerHTML = "修改薪资异动记录";
    document.getElementById("EditUIWindow").src = "AutoLoadForm.aspx?r=" + Math.random() + "&entity=" + const_EditEntity + "&id=" + record.getData(const_entityID);
    SetDWH(550, 350, YAHOO.example.container.dialog1);
    YAHOO.example.container.dialog1.show();
}
//
var fnAddEduHistory = function () {
}

if (typeof ($) != "undefined") {
    $(document).ready(function () {
        //$("#IDCardNO").bind('blur', fnChekcIDCard);
        if (getPar1('id') == "") {
            //alert(parent.parent.getPar1('id'));
            instance[0].EmployeeID = parent.parent.getPar1('id');
        }
    });
}

var fnCustomDelete = function () {
    alert("不能删除薪资调整记录!");
}

//2012.5.4 汪定新 添加
var fnCheckData = function () {
    if (/^\d+(.\d+)?$/.test($("#BaseSalary").val()) == false) {
        return "基本工资需要输入非负数";
    }
    if (/^\d+(.\d+)?$/.test($("#TrafficAllowance").val()) == false) {
        return "交通补贴需要输入非负数";
    }
    if (/^\d+(.\d+)?$/.test($("#HouseAllowance").val()) == false) {
        return "住房补贴需要输入非负数";
    }
    if (/^\d+(.\d+)?$/.test($("#DinnerAllowance").val()) == false) {
        return "伙食补贴需要输入非负数";
    }
}
//